package com.neuedu.shop.controller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;

import com.neuedu.shop.pojo.Collect;
import com.neuedu.shop.service.CollectService;

@Controller
public class CollectController {
	@Autowired
	private CollectService service;
	
	@RequestMapping("/pre/insert.collect")
	public String insert(Collect co) {
		service.insert(co);
		return "redirect:index.product";
	}
	
	@RequestMapping("/pre/findByUserid.collect")
	public String findByUserid(Integer userid,ModelMap map) {
		List<Collect> collects = service.findByUserid(userid);
		map.addAttribute("collects", collects);
		return "forward:collection.jsp";
	}
}